﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Sort
{
    class BubbleSort
    {
        static public void Sort(int[] arr, int k = 0, int z = 0)
        {
            for(int i = 0; i < arr.Length - 1; i++)
            {
                bool bSwap = false;
                for(int j = 0; j < arr.Length - 1 - i; j++)
                {
                    if(arr[j] > arr[j+1])
                    {
                        bSwap = true;
                        lib.Swap<int>(arr, j, j + 1);
                    }
                }

                if (!bSwap)
                    break;
            }

        }
    }
}
